import inquirer from "inquirer";

export const inquirerConfig = async (message) => {
  const answers = await inquirer.prompt({
    type: "confirm",
    name: "confirm",
    message,
  });
  return answers;
};

export const inquirerChoose = async (message, choices, type = "list") => {
  const answers = await inquirer.prompt({
    type,
    name: "choose",
    message,
    choices,
  });
  return answers;
};

export const inquirerInput = async (message) => {
  const answers = await inquirer.prompt({
    type: "input",
    name: "input",
    message,
  });
  return answers;
};

export const inquirerInputs = async (messages) => {
  const answers = await inquirer.prompt(
    messages.map((mag) => {
      return {
        type: "input",
        name: mag.name,
        message: mag.message,
      };
    })
  );
  return answers;
};
